#! /usr/bin/python
from operator import itemgetter

def GetUniqueWords(text):
  unique_words = dict()
  text = text.lower()
  text = text.replace('.',' . ').replace(',',' , ').replace('?', ' ? ').replace('!', ' ! ').replace('--', ' -- ').replace('\"', '').replace(';', ' ; ').replace(':', ' : ')
  words_list = text.split()
  for word in words_list:
    if unique_words.__contains__(word):
      unique_words[word] += 1
    else:
      unique_words[word] = 1
  return unique_words

def SortListOfWords(words_dict):
  sorted_list = sorted(words_dict, key=itemgetter(0))

def DisplayTopTen(self






def main():
  # Open the file, read it into memory as a single string.
  with open('alice_in_wonderland.txt') as alice_file:
    alice_text = alice_file.read()
  unique_words = GetUniqueWords(alice_text)
  sorted_words = SortListOfWords(unique_words)
  



if __name__ == '__main__':
  main()
